home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / wdiff004.lha / wdiff-0.04 / check_it < prev    next >
Text File  |  1992-12-23  |  5KB  |  158 lines

  1. #!/bin/sh
  2. # Check wdiff against some simple test cases.
  3. # Copyright (C) 1992 Free Software Foundation, Inc.
  4.  
  5. wdiff=./wdiff
  6. input1=/tmp/wd.$$a
  7. input2=/tmp/wd.$$b
  8. expect=/tmp/wd.$$c
  9. output=/tmp/wd.$$d
  10.  
  11. fail="echo; echo Check FAILED; rm -f $input1 $input2 $expect $output; exit 1"
  12. trap "$fail" 1 2 3 14 15
  13.  
  14. cat > $input1 <<END_OF_FILE
  15. This is input1
  16. The quick brown fox jumps over the lazy dog.
  17. The hurried orange fox jumps over the lazy dog.
  18. A slow green panda walks around a sleeping cat.
  19. The middling red fox jumps over the lazy dog.
  20. END_OF_FILE
  21.  
  22. cat > $input2 <<END_OF_FILE
  23. This is input2
  24. The quick brown fox jumps over the lazy dog.
  25. The slow red fox jumps over the lazy dog.
  26. A slow, short green giraffe walks around a sleeping cat.
  27. The middling red fox jumps over the lazy dog.
  28. END_OF_FILE
  29.  
  30. echo "Checking wdiff"
  31. cat > $expect <<END_OF_FILE
  32. This is [-input1-] {+input2+}
  33. The quick brown fox jumps over the lazy dog.
  34. The [-hurried orange-] {+slow red+} fox jumps over the lazy dog.
  35. A [-slow-] {+slow, short+} green [-panda-] {+giraffe+} walks around a sleeping cat.
  36. The middling red fox jumps over the lazy dog.
  37. END_OF_FILE
  38. $wdiff $input1 $input2 > $output
  39. diff $expect $output || eval "$fail"
  40.  
  41. echo "Checking wdiff -1"
  42. cat > $expect <<END_OF_FILE
  43. This is {+input2+}
  44. The quick brown fox jumps over the lazy dog.
  45. The {+slow red+} fox jumps over the lazy dog.
  46. A {+slow, short+} green {+giraffe+} walks around a sleeping cat.
  47. The middling red fox jumps over the lazy dog.
  48. END_OF_FILE
  49. $wdiff -1 $input1 $input2 > $output
  50. diff $expect $output || eval "$fail"
  51.  
  52. echo "Checking wdiff -2"
  53. cat > $expect <<END_OF_FILE
  54. This is [-input1-]
  55. The quick brown fox jumps over the lazy dog.
  56. The [-hurried orange-] fox jumps over the lazy dog.
  57. A [-slow-] green [-panda-] walks around a sleeping cat.
  58. The middling red fox jumps over the lazy dog.
  59. END_OF_FILE
  60. $wdiff -2 $input1 $input2 > $output
  61. diff $expect $output || eval "$fail"
  62.  
  63. echo "Checking wdiff -3"
  64. cat > $expect <<END_OF_FILE
  65.  
  66. ======================================================================
  67.  [-input1-] {+input2+}
  68. ======================================================================
  69.  [-hurried orange-] {+slow red+}
  70. ======================================================================
  71.  [-slow-] {+slow, short+}
  72. ======================================================================
  73.  [-panda-] {+giraffe+}
  74. ======================================================================
  75. END_OF_FILE
  76. $wdiff -3 $input1 $input2 > $output
  77. diff $expect $output || eval "$fail"
  78.  
  79. echo "Checking wdiff -12"
  80. cat > $expect <<END_OF_FILE
  81. This is
  82. ======================================================================
  83.  
  84. The quick brown fox jumps over the lazy dog.
  85. The
  86. ======================================================================
  87.  fox jumps over the lazy dog.
  88. A
  89. ======================================================================
  90.  green
  91. ======================================================================
  92.  walks around a sleeping cat.
  93. The middling red fox jumps over the lazy dog.
  94. END_OF_FILE
  95. $wdiff -12 $input1 $input2 > $output
  96. diff $expect $output || eval "$fail"
  97.  
  98. echo "Checking wdiff -13"
  99. cat > $expect <<END_OF_FILE
  100.  
  101. ======================================================================
  102.  input2
  103. ======================================================================
  104.  slow red
  105. ======================================================================
  106.  slow, short
  107. ======================================================================
  108.  giraffe
  109. ======================================================================
  110. END_OF_FILE
  111. $wdiff -13 $input1 $input2 > $output
  112. diff $expect $output || eval "$fail"
  113.  
  114. echo "Checking wdiff -23"
  115. cat > $expect <<END_OF_FILE
  116.  
  117. ======================================================================
  118.  input1
  119. ======================================================================
  120.  hurried orange
  121. ======================================================================
  122.  slow
  123. ======================================================================
  124.  panda
  125. ======================================================================
  126. END_OF_FILE
  127. $wdiff -23 $input1 $input2 > $output
  128. diff $expect $output || eval "$fail"
  129.  
  130. echo "Checking wdiff -123"
  131. cat > $expect <<END_OF_FILE
  132. END_OF_FILE
  133. $wdiff -123 $input1 $input2 > $output
  134. diff $expect $output || eval "$fail"
  135.  
  136. echo "Checking wdiff -123s"
  137. cat > $expect <<END_OF_FILE
  138. $input1: 39 words  34 87% common  0 0% deleted  5 12% changed
  139. $input2: 40 words  34 85% common  0 0% inserted  6 15% changed
  140. END_OF_FILE
  141. $wdiff -123s $input1 $input2 > $output
  142. diff $expect $output || eval "$fail"
  143.  
  144. echo "Checking wdiff -wxyz"
  145. cat > $expect <<END_OF_FILE
  146. This is (input1) <<input2>>
  147. The quick brown fox jumps over the lazy dog.
  148. The (hurried orange) <<slow red>> fox jumps over the lazy dog.
  149. A (slow) <<slow, short>> green (panda) <<giraffe>> walks around a sleeping cat.
  150. The middling red fox jumps over the lazy dog.
  151. END_OF_FILE
  152. $wdiff -w\( -x\) -y\<\< -z\>\> $input1 $input2 > $output
  153. diff $expect $output || eval "$fail"
  154.  
  155. rm -f $input1 $input2 $expect $output
  156. echo
  157. echo All checks successful
  158.